package com.wj.infrastructure.mapper;

import com.wj.domain.vo.BookCacheVO;
import com.wj.domain.vo.BookVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description 书籍缓存Mapper
 * @author wj
 * @date 2022-02-14
 */
@Mapper
public interface BookCacheMapper {

    @Results(value = {
            @Result(property = "id", column = "id"),
            @Result(property = "bookName", column = "book_name"),
            @Result(property = "bookUrl", column = "book_url"),
            @Result(property = "author", column = "author"),
            @Result(property = "type", column = "type"),
            @Result(property = "newest", column = "newest"),
            @Result(property = "state", column = "state"),
            @Result(property = "number", column = "number"),
            @Result(property = "bookDesc", column = "book_desc"),
            @Result(property = "imgUrl", column = "img_url"),
            @Result(property = "views", column = "views"),
            @Result(property = "updateTime", column = "update_time"),
    })
    @Select(value = "<script>" +
            " select a.id,a.book_name,a.book_url,a.author,a.type," +
            " a.newest,a.state,a.number,a.book_desc,a.img_url,a.views, a.update_time " +
            " from book as a " +
            " where a.deleted=0 and a.cache_status=1 " +
            "</script>")
    List<BookVO> getCacheBookList();



}